/**   
 * @Title: MyController.java 
 * @Package com.dragon.learn.web.controller 
 * @Description: TODO(用一句话描述该文件做什么) 
 * @author dragon   
 * @date 2018年8月21日 下午10:50:27 
 * @version V1.0   
 */
package com.dragon.learn.web.controller;

import com.dragon.learn.web.service.MyService;
import com.dragon.learn.web.vo.MyVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/** 
 * @ClassName: MyController 
 * @Description: TODO(这里用一句话描述这个类的作用) 
 * @author dragon
 * @date 2018年8月21日 下午10:50:27 
 *  
 */
@Controller
public class MyController {

	@Autowired
    MyService myService;

	@RequestMapping(value = "page/{page}")
	public String page(@PathVariable String page) {
		return page;
	}
	
	@RequestMapping("anno")
	public @ResponseBody String index(HttpServletRequest request) {
		
		return "url:" + request.getRequestURL() + " can access";
	}
	
	@RequestMapping(value= "anno1", produces = "text/plain;charset=UTF-8")
	public @ResponseBody String index1(HttpServletRequest request) {
		
		return "url:" + request.getRequestURL() + " can access";
	}
	@RequestMapping(value= "anno2", produces = "application/xml;charset=UTF-8")
	public @ResponseBody String index2(HttpServletRequest request) {
		
		return "url:" + request.getRequestURL() + " can access";
	}
	
	@RequestMapping(value= "anno3", produces = "application/json;charset=UTF-8")
	public @ResponseBody String index3(HttpServletRequest request) {
		
		return "url:" + request.getRequestURL() + " can access";
	}

	@RequestMapping(value = "getvos")
	public @ResponseBody List<MyVO> getVos(){
		return  myService.getVos();
	}
}
